#include  <cstdio>
#include  <cstring>
#include  <cstdlib>

inline void swap(char &a, char &b)
{
	char t = a;
	a = b;
	b = t;
}

void reverse(char *s)
{
	int len = strlen(s);
	for( int i = 0, j = len-1; i < j ; ++i,--j )
		swap(s[i],s[j]);
}

int main(int argc, char *argv[])
{
	int n;
	char a[30],b[50];
	scanf("%d",&n);

	while(n--)
	{
		scanf("%s %s",a,b);
		reverse(a);
		reverse(b);
		int aa,bb;
		aa = atoi(a);
		bb = atoi(b);
		int sum = aa+bb;
		sprintf(a,"%d",sum);
		reverse(a);
		aa = atoi(a);
		printf("%d\n",aa);
	}
}
